<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Document</title>
</head>

<body>
   <div id="app">
        <form action="save" v-on:submit.prevent="onSubmitForm">
            <input type="text" id="name" v-model="users.username">
            <button type="submit">保存</button>
        </form>
   </div>
   <script src="vue.min.js"> </script>
   <script>
   new Vue({
      el: '#app',
      data: {
            users:{
                username:"周云霞"
            } 
         },
      methods:{
            onSubmitForm(){
                if(this.users.username){
                    console.log('提交表单')
                }else{
                    alert('请输入用户名')
                }
           }
      }

  })
  </script>
</body>

</html>